﻿@{
    Layout = "../Shared/_LayoutMain.cshtml";

}
<link rel="stylesheet" href="~/main/css/case.css">
    <style>
        nav#main-navigation {
            position: relative;
            margin-bottom: 0;
        }

        #main-navigation .nav > li > a {
            color: #464646;
            padding: 21px 15px;
        }

        a.logo {
            background: url(../main/images/logo.png) no-repeat;
            background-size: contain;
        }

        #main-navigation .nav-pills > li.active > a::after {
            top: 50px;
        }
        .news-list {
            margin-top: 20px;
            margin-bottom: 20px;
        }
        .news-title {
			color: #337ab7;
		}
    </style>
  <div class="clearfix swiper" style="background-image:url(../main/images/banner3.png);
	background-repeat:no-repeat ;
	background-position: center;
	height: 200px;
	">
        <div class="container">
            <div class="banner3">
                <h3>常见问题</h3>
            </div>
        </div>
    </div>
    <div style="background: #F6F8FB;">
        <div class="container">
            <!-- 面包屑导航 -->
            <ul class="breadcrumb row">
                <span>您的位置：</span>
                <li><a href="/">首页</a><span class="divider"></span></li>
                <li><a class="divider" href="/News/Rss/常见问题" target="_blank">常见问题<img src="/main/images/rss.png" style="width: 16px;height: 16px;" /></a></li>
            </ul>
        </div>
    </div>
    <div class="container">
        <div class="row news-list" id="newslist"></div>
        <ul class="pagination" id="pagination">
        </ul>
    </div>

@section Scripts{
<script type="text/javascript">

        var page = $.request("page");
        if (!!page) { } else { page = 1 }
        $(function () {
            NewsAll("常见问题", "newslist");
        });
        function NewsAll(action, idname) {
            var paramform = {
                "keyword": "",
                "rows": 12,
                "page": page,
                "sidx": "AddTime",
                "sord": "DESC",
                "field": "*",
                "sqlwhere": "Category='" + action + "'",
                "total": 0,
                "totalCount": 0
            };
            $.ajax({
                url: "/api/News/GetJGridPageDataJson",
                data: JSON.stringify(paramform),
                type: "post",
                dataType: "json",
                contentType: "application/json",
                success: function (data) {
                    var _data = data.rows;
                    var html = '';
                    $.each(_data, function (i) {
                        var row = _data[i];
                        if (row.Url == "") row.Url = "Faq/Show/" + row.ID;
                        if (row.TitlePic == "") row.TitlePic = "../main/images/news.png";
                        if (row.SmallText == "undefined") row.SmallText = "";
                        html += "  <div class='row news-list'>      ";
                        html += "      <div class='col-md-2'>   ";
                        html += "        <a href='" + row.Url + "'><img class='media-img img-rounded img-responsive' src='/upfile/" + row.TitlePic + "' onerror=\"this.src='../main/images/news.png'\"></a>   ";
                        html += "    </div>    ";
                        html += "    <div class='col-md-10 news-body'>    ";
                        html += "       <div>           ";
                        html += "            <a href='" + row.Url + "'> <h4 class='news-title'>" + row.Title + "</h4>   </a>       ";
                        html += "            <a class='news-text' href='" + row.Url + "'>" + row.SmallText + " </a>     ";
                        html += "        </div>   ";
                        html += "        <div class='news-time text-right'>    ";
                        html += "            <span class='time1'>" + new Date(row.AddTime).Format("MM-dd") + "</span>  ";
                        html += "            <span class='time2'>" + new Date(row.AddTime).Format("yyyy") + "</span>  ";
                        html += "       </div>    ";
                        html += "    </div>  ";
                        html += "  </div>  ";

                    });
                    $("#" + idname).html("");
                    $("#" + idname).html(html);

                    var pagination = '';
                    if (data.total > 1) {
                        pagination += '<li class="page-item"><a class="page-link" href="/news/Faq?page=1">首页</a></li>';
                        if (page > 1) {
                            var lyypage = parseInt(page) - 1;
                            pagination += '<li class="page-item"><a class="page-link" href="/news/Faq?page=' + lyypage + '">上一页</a></li>';
                        } else {
                            pagination += '<li class="page-item disabled"><span class="page-link">上一页</span></li>';
                        }
                        if (page > data.total) {
                            pagination += '<li class="page-item disabled"><span class="page-link">下一页</span></li>';
                        } else {
                            var xyypage = parseInt(page) + 1;
                            pagination += '<li class="page-item"><a class="page-link" href="/news/Faq?page=' + xyypage + '">下一页</a></li>';
                        }
                        pagination += '<li class="page-item"><a class="page-link" href="/news/Faq?page=' + data.total + '">尾页</a></li>';

                        $("#pagination").html(pagination);
                    }
            
                }
            });
        }
    </script>
}